using System;
using System.Data.Common;
using System.Data.SqlServerCe;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Be.Timvw.Framework.Data.SqlCe.Tests.SqlCeClientFactory
{
    [TestClass]
    public class WhenUsing
    {
        [TestMethod]
        public void CreateCommandShouldReturnSqlCeCommand()
        {
            DbProviderFactory factory = new SqlCe.SqlCeClientFactory();
            DbCommand command = factory.CreateCommand();
            Type actual = command.GetType();

            Type expected = typeof(SqlCeCommand);

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void CreateCommandBuilderShouldReturnSqlCeCommandBuilder()
        {
            DbProviderFactory factory = new SqlCe.SqlCeClientFactory();
            DbCommandBuilder builder = factory.CreateCommandBuilder();
            Type actual = builder.GetType();

            Type expected = typeof(SqlCeCommandBuilder);

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void CreateConnectionShoulReturnSqlCeConnection()
        {
            DbProviderFactory factory = new SqlCe.SqlCeClientFactory();
            DbConnection connection = factory.CreateConnection();
            Type actual = connection.GetType();

            Type expected = typeof(SqlCeConnection);

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void CreateDataAdapterShouldReturnSqlCeDataAdapter()
        {
            DbProviderFactory factory = new SqlCe.SqlCeClientFactory();
            DbDataAdapter adapter = factory.CreateDataAdapter();
            Type actual = adapter.GetType();

            Type expected = typeof(SqlCeDataAdapter);

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void CreateParameterShouldReturnSqlCeParameter()
        {
            DbProviderFactory factory = new SqlCe.SqlCeClientFactory();
            DbParameter parameter = factory.CreateParameter();
            Type actual = parameter.GetType();

            Type expected = typeof(SqlCeParameter);

            Assert.AreEqual(expected, actual);
        }
    }
}